<?php
namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller {
	//主页
    public function index(){
    	$this->assign('invitelist',D('invite')->limit('8')->order('addtime desc')->select());
    	$this->assign('rylist',D('ryinfo')->limit('8')->order('addtime desc')->select());
        $this->display();
    }

    //招聘信息列表
    public function invitelist(){
    	$this->assign('invitelist',D('invite')->order('addtime desc')->select());
    	$this->display();
    }

    //招聘信息内容
    public function inviteinfo(){
    	if(IS_GET){
    		$id = $_GET['id'];
    		$inviteinfo = D('invite')->where("id='".$id."'")->find();
    		$inviteinfo['in_content'] = htmlspecialchars_decode(html_entity_decode($inviteinfo['in_content']));
    		$this->assign('inviteinfo',$inviteinfo);
    		$this->display();
    	}
    }

    //教师资源列表
    public function tealist(){
    	$this->assign('rylist',D('ryinfo')->order('addtime desc')->select());
    	$this->display();
    }

    //教师资源内容
    public function teainfo(){
    	if(IS_GET){
    		$id = $_GET['id'];
    		$ryinfo = D('ryinfo')->where("id='".$id."'")->find();
    		$ryinfo['ry_jianjie'] = htmlspecialchars_decode(html_entity_decode($ryinfo['ry_jianjie']));
    		$this->assign('ryinfo',$ryinfo);
    		$this->display();
    	}
    }

    //问题反馈
    public function feedback(){
        if (IS_POST) {
            $_POST['addtime'] = time();
            if (D('feedback')->add(I('post.'))) {
                $this->success('反馈成功','/graduation/home/index/feedback',1);exit;
            }else{
                $this->success('反馈失败','',1);exit;
            }
        }
    	$this->display();
    }
}